package com.heying.springcore.javaconfig;

public class Student {

    private String name;

    private int money;

    private Student stu;

    public Student() {
    }

    public Student(String name, int money) {
        this.name = name;
        this.money = money;
    }

    public Student getStu() {
        return stu;
    }

    public void setStu(Student stu) {
        this.stu = stu;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", money=" + money +
                '}';
    }
    //借入
    public void borrow(int money){
        stu.lend(money);
        this.money += money;

    }

    // 借出
    public void lend(int money){
        this.money -= money;
    }
}
